package bilibili;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

class Test1 {
    public static void main(String[] args) {
        final Scanner sc = new Scanner(System.in);

        final List<ArrayList<Integer>> res = new ArrayList<>();
        while (sc.hasNextLine()) {
            String str = sc.nextLine();
            final ArrayList<Integer> list1 = new ArrayList<>();
            for (int i = 0; i < str.length(); i++) {
                if (Character.isDigit(str.charAt(i))) {
                    list1.add(Integer.parseInt(str.charAt(i) + ""));
                }
            }
            res.add(list1);
        }
        int row = res.size();
        int col = res.get(0).size();
        int[][] arr = new int[row][col];
        for (int i = 0; i < res.size(); i++) {
            for (int j = 0; j < res.get(i).size(); j++) {
                arr[i][j] = res.get(i).get(j);
            }
        }
        final int i = maxAreaOfIsland(arr);
        System.out.println(i);


    }

    public static int maxAreaOfIsland(int[][] grid) {
        //dfs
        int maxArea = 0;
        for (int i = 0; i < grid.length; i++) {
            for (int j = 0; j < grid[0].length; j++) {
                if (grid[i][j] == 1) {
                    maxArea = Math.max(maxArea, dfs(grid, i, j));
                }
            }
        }
        return maxArea;
    }

    public static int dfs(int[][] grid, int i, int j) {
        if (i >= 0 && i < grid.length && j >= 0 && j < grid[0].length && grid[i][j] == 1) {
            //如果当前位置是1 为了防止重复计算 把它置为0
            grid[i][j] = 0;
            return 1 + dfs(grid, i + 1, j) + dfs(grid, i - 1, j) + dfs(grid, i, j + 1) + dfs(grid, i, j - 1);
        }
        return 0;
    }
}